/* eslint-disable no-unused-vars */
'use strict';

// project_name: STRING(255),
// project_address: STRING(255),
// project_users: ARRAY,
// deadline: DATE,
// logo_url: STRING(255),
// put_on_record: STRING(255),
// proxy_string: STRING(255),
// pro_env: STRING(512),
// dev_env: STRING(512),
// test_env: STRING(512),
// output_path: STRING(255),
module.exports = app => {
  const { STRING, INTEGER, ENUM, DATE } = app.Sequelize;

  const Project = app.model.define(
    'project',
    {
      id: { type: INTEGER, primaryKey: true, autoIncrement: true },
      project_name: {
        type: STRING(255),
        allowNull: true,
        comment: '项目名',
        unique: true,
      },
      project_address: {
        type: STRING(255),
        allowNull: true,
        comment: '项目地址',
        unique: true,
      },
      project_users: {
        type: STRING(512),
        allowNull: true,
        comment: '项目成员',
        unique: true,
      },
      deadline: {
        type: DATE,
        allowNull: true,
        comment: '截止日期',
        unique: true,
      },
      logo_url: {
        type: STRING(255),
        allowNull: true,
        comment: '项目logo',
        unique: true,
      },
      put_on_record: {
        type: STRING(255),
        allowNull: true,
        comment: '项目备案',
        unique: true,
      },
      proxy_string: {
        type: STRING(255),
        allowNull: true,
        comment: '代理字符',
        unique: true,
      },
      pro_env: {
        type: STRING(1024),
        allowNull: true,
        comment: '发布生产环境',
        unique: true,
      },
      dev_env: {
        type: STRING(1024),
        allowNull: true,
        comment: '发布开发环境',
        unique: true,
      },
      test_env: {
        type: STRING(1024),
        allowNull: true,
        comment: '发布测试环境',
        unique: true,
      },
      output_path: {
        type: STRING(255),
        allowNull: true,
        comment: '打包文件夹名称',
        unique: true,
      },
      created_at: DATE,
      updated_at: DATE,
    },
    {
      timestamps: true,
      createdAt: 'created_at',
      updatedAt: 'updated_at',
    }
  );

  return Project;
};

//     freezeTableName: true,  使用自定义表名
//     // 实例对应的表名
//     tableName: 'user',
//     // 如果需要sequelize帮你维护createdAt,updatedAt和deletedAt必须先启用timestamps功能
//     // 将createdAt对应到数据库的created_at字段
//     createdAt: 'created_at',
//     // 将updatedAt对应到数据库的updated_at字段
//     updatedAt: 'updated_at',
//     //And deletedAt to be called destroyTime (remember to enable paranoid for this to work)
//     deletedAt: false, //'deleted_at',
//     //删除数据时不删除数据，而是更新deleteAt字段 如果需要设置为true，则上面的deleteAt字段不能为false，也就是说必须启用
//     paranoid: false
